/*  1:   */ package org.jetbrains.jps.model.serialization;
/*  2:   */ 
/*  3:   */

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsGlobal;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.serialization.impl.JpsModuleSerializationDataExtensionImpl;
import org.jetbrains.jps.model.serialization.impl.JpsPathVariablesConfigurationImpl;
import org.jetbrains.jps.model.serialization.impl.JpsProjectSerializationDataExtensionImpl;
import org.jetbrains.jps.model.serialization.module.JpsModuleSerializationDataExtension;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */ 
/* 17:   */ public class JpsModelSerializationDataService
/* 18:   */ {
/* 19:   */   /**
/* 20:   */    * @deprecated
/* 21:   */    */
/* 22:   */   @NotNull
/* 23:   */   public static Map<String, String> getAllPathVariables(JpsGlobal paramJpsGlobal)
/* 24:   */   {
/* 25:41 */     Map tmp4_1 = computeAllPathVariables(paramJpsGlobal);
/* 26:41 */     if (tmp4_1 == null) {
/* 27:41 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getAllPathVariables" }));
/* 28:   */     }
/* 29:41 */     return tmp4_1;
/* 30:   */   }
/* 31:   */   
/* 32:   */   public static Map<String, String> computeAllPathVariables(JpsGlobal paramJpsGlobal)
/* 33:   */   {
/* 34:45 */     HashMap localHashMap = new HashMap(PathMacroUtil.getGlobalSystemMacros());
/* 35:46 */     JpsPathVariablesConfiguration localJpsPathVariablesConfiguration = getPathVariablesConfiguration(paramJpsGlobal);
/* 36:47 */     if (localJpsPathVariablesConfiguration != null) {
/* 37:48 */       localHashMap.putAll(localJpsPathVariablesConfiguration.getAllUserVariables());
/* 38:   */     }
/* 39:50 */     return localHashMap;
/* 40:   */   }
/* 41:   */   
/* 42:   */   @Nullable
/* 43:   */   public static JpsPathVariablesConfiguration getPathVariablesConfiguration(JpsGlobal paramJpsGlobal)
/* 44:   */   {
/* 45:55 */     return (JpsPathVariablesConfiguration)paramJpsGlobal.getContainer().getChild(JpsGlobalLoader.PATH_VARIABLES_ROLE);
/* 46:   */   }
/* 47:   */   
/* 48:   */   @NotNull
/* 49:   */   public static JpsPathVariablesConfiguration getOrCreatePathVariablesConfiguration(JpsGlobal paramJpsGlobal)
/* 50:   */   {
/* 51:60 */     JpsPathVariablesConfiguration localJpsPathVariablesConfiguration = (JpsPathVariablesConfiguration)paramJpsGlobal.getContainer().getChild(JpsGlobalLoader.PATH_VARIABLES_ROLE);
/* 52:61 */     if (localJpsPathVariablesConfiguration == null)
/* 53:   */     {
/* 54:62 */       JpsPathVariablesConfiguration tmp46_43 = ((JpsPathVariablesConfiguration)paramJpsGlobal.getContainer().setChild(JpsGlobalLoader.PATH_VARIABLES_ROLE, new JpsPathVariablesConfigurationImpl()));
/* 55:62 */       if (tmp46_43 == null) {
/* 56:62 */         throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getOrCreatePathVariablesConfiguration" }));
/* 57:   */       }
/* 58:62 */       return tmp46_43;
/* 59:   */     }
/* 60:64 */     JpsPathVariablesConfiguration tmp82_81 = localJpsPathVariablesConfiguration;
/* 61:64 */     if (tmp82_81 == null) {
/* 62:64 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getOrCreatePathVariablesConfiguration" }));
/* 63:   */     }
/* 64:64 */     return tmp82_81;
/* 65:   */   }
/* 66:   */   
/* 67:   */   @Nullable
/* 68:   */   public static JpsProjectSerializationDataExtension getProjectExtension(@NotNull JpsProject paramJpsProject)
/* 69:   */   {
/* 70:70 */     if (paramJpsProject == null) {
/* 71:70 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getProjectExtension" }));
/* 72:   */     }
/* 73:70 */     return (JpsProjectSerializationDataExtension)paramJpsProject.getContainer().getChild(JpsProjectSerializationDataExtensionImpl.ROLE);
/* 74:   */   }
/* 75:   */   
/* 76:   */   @Nullable
/* 77:   */   public static File getBaseDirectory(@NotNull JpsProject paramJpsProject)
/* 78:   */   {
/* 79:75 */     if (paramJpsProject == null) {
/* 80:75 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getBaseDirectory" }));
/* 81:   */     }
/* 82:75 */     JpsProjectSerializationDataExtension localJpsProjectSerializationDataExtension = getProjectExtension(paramJpsProject);
/* 83:76 */     return localJpsProjectSerializationDataExtension != null ? localJpsProjectSerializationDataExtension.getBaseDirectory() : null;
/* 84:   */   }
/* 85:   */   
/* 86:   */   @Nullable
/* 87:   */   public static JpsModuleSerializationDataExtension getModuleExtension(@NotNull JpsModule paramJpsModule)
/* 88:   */   {
/* 89:81 */     if (paramJpsModule == null) {
/* 90:81 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getModuleExtension" }));
/* 91:   */     }
/* 92:81 */     return (JpsModuleSerializationDataExtension)paramJpsModule.getContainer().getChild(JpsModuleSerializationDataExtensionImpl.ROLE);
/* 93:   */   }
/* 94:   */   
/* 95:   */   @Nullable
/* 96:   */   public static File getBaseDirectory(@NotNull JpsModule paramJpsModule)
/* 97:   */   {
/* 98:86 */     if (paramJpsModule == null) {
/* 99:86 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getBaseDirectory" }));
/* :0:   */     }
/* :1:86 */     JpsModuleSerializationDataExtension localJpsModuleSerializationDataExtension = getModuleExtension(paramJpsModule);
/* :2:87 */     return localJpsModuleSerializationDataExtension != null ? localJpsModuleSerializationDataExtension.getBaseDirectory() : null;
/* :3:   */   }
/* :4:   */   
/* :5:   */   @Nullable
/* :6:   */   public static String getPathVariableValue(@NotNull JpsGlobal paramJpsGlobal, @NotNull String paramString)
/* :7:   */   {
/* :8:92 */     if (paramJpsGlobal == null) {
/* :9:92 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getPathVariableValue" }));
/* ;0:   */     }
/* ;1:92 */     if (paramString == null) {
/* ;2:92 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/serialization/JpsModelSerializationDataService", "getPathVariableValue" }));
/* ;3:   */     }
/* ;4:92 */     String str = PathMacroUtil.getGlobalSystemMacroValue(paramString);
/* ;5:93 */     if (str != null) {
/* ;6:94 */       return str;
/* ;7:   */     }
/* ;8:96 */     JpsPathVariablesConfiguration localJpsPathVariablesConfiguration = getPathVariablesConfiguration(paramJpsGlobal);
/* ;9:97 */     return localJpsPathVariablesConfiguration != null ? localJpsPathVariablesConfiguration.getUserVariableValue(paramString) : null;
/* <0:   */   }
/* <1:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.serialization.JpsModelSerializationDataService

 * JD-Core Version:    0.7.0.1

 */